﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MadProps.Definition
{
    public sealed class MetadataBuildArgs
    {
        public PropId PropId { get; private set; }
        public ClrMember ClrMember { get { return PropId.ClrMember; } }
        readonly Dictionary<string, object> values;

        internal MetadataBuildArgs(PropId propId, Dictionary<string, object> values)
        {
            this.PropId = propId.ThrowIfNull("propId");
            this.values = values.ThrowIfNull("values");
        }

        public void SetMetadata<T>(Meta.Key<T> key, T value)
        {
            key.ThrowIfNull("key");
            values[key.theString] = value;
        }

        public void SetMetadata(string key, object value)
        {
            key.ThrowIfNull("key");
            values[key] = value;
        }
    }
}
